package isPalindrome;

import java.util.ArrayList;
import java.util.List;

class Test {
    public static void main(String[] args) {
        System.out.println(new Solution().isPalindrome(123));
    }
}


class Solution {
    public boolean isPalindrome(int x) {
        if (x < 0) return false;
        List s = new ArrayList();
        while (x != 0) {
            s.add(x % 10);
            x /= 10;
        }
        int j = s.size() - 1;
        for (int i = 0; i < s.size(); i++) {
            if (i <= j) {
                if (s.get(i) != s.get(j)) return false;
                j--;
            }
        }
        return true;
    }
}